package leets.leet693;

public class Solution {
    public boolean hasAlternatingBits(int n) {
        while (n>0){
            if (((n&1)^((n&2)>>1))!=1){
                return false;
            }
            n=(n>>1);
        }
        return true;
    }




}
